//
//  AsModeViewController.swift
//  onemeetingmac
//
//  Created by 张衡 on 2020/7/3.
//  Copyright © 2020 onemeeting. All rights reserved.
//

import Foundation

class AsModeViewController: NSViewController {
    var currentWindow:NSWindow? {
        return self.view.window
    }
    
    override func loadView() {
        let view = NSView.init(frame:NSMakeRect(0, 0, 400, 300))
        view.wantsLayer = true
        view.layer?.backgroundColor = NSColor.white.cgColor
        self.view = view
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    override func viewWillAppear() {
        super.viewWillAppear()
        self.setWindow()
    }
    
    func setWindow() {
        
        self.currentWindow?.collectionBehavior = NSWindow.CollectionBehavior.fullScreenPrimary
        
        self.currentWindow?.styleMask = [.titled,.closable,.fullSizeContentView]
        self.currentWindow?.backingType = .buffered
        self.currentWindow?.isOpaque = false
        
        //设置圆角
        self.currentWindow?.contentView?.wantsLayer = true
        self.currentWindow?.contentView?.layer?.masksToBounds = true
        self.currentWindow?.contentView?.layer?.cornerRadius = 5
        self.currentWindow?.backgroundColor = NSColor.clear
        
        //可拖动的
        self.currentWindow?.isMovable = true
        self.currentWindow?.isMovableByWindowBackground = true
        
        //隐藏
        self.currentWindow?.titlebarAppearsTransparent = true
        self.currentWindow?.titleVisibility = .hidden
        self.currentWindow?.toolbar?.showsBaselineSeparator = false
        
        //self.currentWindow?.standardWindowButton(.closeButton)?.isHidden = true
        self.currentWindow?.standardWindowButton(.zoomButton)?.isHidden = true
        self.currentWindow?.standardWindowButton(.miniaturizeButton)?.isHidden = true
        
    }
    
    
    
}
